#include <REGX52.H>
#include "LCD1602.h"
#include "IR.h"
#include "Timer.h"
#include "Delay.h"

unsigned char Add, Com, Num;

void main()
{
	LCD_Init();
	IR_Init();
	LCD_ShowString(1, 1, "Add  Com  Num");
	LCD_ShowString(2, 1, "00   00   000");
    while(1)
    {
		if(IR_DataReady() || IR_GetRepeatFlag())
		{
			Add = IR_GetAddress();
			Com = IR_GetCommand();
			LCD_ShowHexNum(2, 1, Add, 2);
			LCD_ShowHexNum(2, 6, Com, 2);
			
			if(Com == IR_VOL_MINUS)
				Num--;
			else if(Com == IR_VOL_ADD)
				Num++;
			LCD_ShowNum(2, 11, Num, 3);
		}	
    }
}